<!-- 右 -->
<div class="content">
    <div class="header">
        <h1 class="page-title">商品类型新增</h1>
    </div>

    <div class="well">
        <!-- add form -->
        <form id="tab" action="{:url('admin/type/update')}" method="post">
            <input type="hidden" value="{$data.id}" name="id">
            <label>类型名称：</label>
            <input type="text" name="type_name" value="{$data.type_name}" class="input-xlarge">

            <label></label>
            <button class="btn btn-primary" type="submit">保存</button>
        </form>
    </div>
</div>
<script>
    $(".btn-primary").click(function(){
        var flag = true;

        if($(".input-xlarge").val() == ""){
            alert("商品类型不允许为空");
            flag = false;
        }

        if(flag){
            $("#tab").submit();
        }
    })
</script>